import request from "@/utils/request";

const STRATEGY_BASE_URL = "/ig/theme";

const Solidify_BASE_URL = "/ig/indicator-solidify";

const IndicatorSolidifyAPI = {
  TableList() {
    return request<any, TopicOptions[]>({
      url: `${STRATEGY_BASE_URL}/list`,
      method: "get",
    });
  },
  Insert(data?: Solidify) {
    return request<any, any>({
      url: `${Solidify_BASE_URL}/create`,
      method: "post",
      data: data,
    });
  },
  Delete(data?: IdRequestParameter) {
    return request({
      url: `${Solidify_BASE_URL}/delete`,
      method: "post",
      data: data,
    });
  },
  Update(data?: Solidify) {
    return request({
      url: `${Solidify_BASE_URL}/update`,
      method: "post",
      data: data,
    });
  },
  Info(data?: IdRequestParameter) {
    return request<any, Solidify>({
      url: `${Solidify_BASE_URL}/info`,
      method: "post",
      data: data,
    });
  },
  Page(data?: SolidifyQuery) {
    return request<any, PageResult<SolidifyPageResponse[]>>({
      url: `${Solidify_BASE_URL}/page`,
      method: "post",
      data: data,
    });
  },
  TimeColumnList(data?: IdRequestParameter) {
    return request<any, TimeColumnOptions[]>({
      url: `${Solidify_BASE_URL}/time/column`,
      method: "post",
      data: data,
    });
  },
  Operational(data?: IdParameter) {
    return request<any, IndicatorOperationalResponse>({
      url: `${Solidify_BASE_URL}/operational`,
      method: "post",
      data: data,
    });
  },
  TestRun(data?: IdParameter) {
    return request<any, IndicatorOperationalResponse>({
      url: `${Solidify_BASE_URL}/operational/test`,
      method: "post",
      data: data,
    });
  },
};

export default IndicatorSolidifyAPI;

export interface IdParameter {
  id?: number;
}

export interface IndicatorOperationalResponse {
  fileNames?: string[];
  entityList?: any[];
}

export interface SolidifyQuery {
  pageIndex: number;
  pageSize: number;
}

export interface IdRequestParameter {
  id?: number;
}

export interface TopicOptions {
  id?: number;
  tableName?: string;
}

export interface TimeColumnOptions {
  id?: number;
  timeColumn?: string;
}

export interface Solidify {
  /**
   * 主键Id
   * */
  id?: number;

  /**
   * 主题表Id
   * */
  themeTableId?: number;

  /**
   * 数据期列
   * */
  timeColumn?: string;

  /**
   * 自定义数据期列
   */
  customizeTime?: string;

  /**
   * 增量固化信息
   * */
  dataPeriod?: string;

  /**
   * 执行周期
   * */
  executionCycle?: string;

  /** 月*/
  month?: string;

  /** 周*/
  week?: string;

  /** 天 */
  day?: string;

  /** 时间*/
  time?: string;

  /** 自定义执行周期 */
  customizeExecutionCycle?: string;
}

export interface SolidifyPageResponse {
  /**
   * 主键Id
   * */
  id?: number;

  /**
   * 主题表Id
   * */
  themeTableId?: number;

  /**
   * 数据期列
   * */
  timeColumn?: string;

  /**
   * 自定义数据期列
   */
  customizeTime?: string;

  /**
   * 增量固化信息
   * */
  dataPeriod?: string;

  /**
   * 执行周期
   * */
  executionCycle?: string;

  /** 月*/
  month?: string;

  /** 周*/
  week?: string;

  /** 天 */
  day?: string;

  /** 时间*/
  time?: string;

  /** 自定义执行周期 */
  customizeExecutionCycle?: string;
}
